import doc.resources.CommandWord;

/**
 * This class is part of the "World of Zuul" application. 
 * "World of Zuul" is a very simple, text based adventure game.  
 * 
 * This class holds an enumeration of all command words known to the game.
 * It is used to recognise commands as they are typed in.
 *
 * @author  Michael Kölling and David J. Barnes
 * @version 2016.02.29gv g20
 */

public class CommandWords
{


    /**
     * Constructor - initialise the command words.
     */
    public CommandWords()
    {
        // nothing to do at the moment...
    }

    /**
     * Check whether a given String is a valid command word. 
     * @return true if a given string is a valid command,
     * false if it isn't.
     */
    public boolean isCommand(String aString)
    {
        CommandWord[] validCommands = CommandWord.values();
        for(int i = 0; i < validCommands.length; i++) {
            if(validCommands[i].getName().equals(aString))
                return true;
        }
        // if we get here, the string was not found in the commands
        return false;
    }

    public static void printCommands(){
        CommandWord[] validCommands = CommandWord.values();
        String str = "你可以使用的命令有：";
        for(int i = 0; i < validCommands.length; i++) {
            str += validCommands[i].getName()+" ";

        }
        System.out.println(str);
    }
}
